//
//  BaseViewController.swift
//  MagicWeibo
//
//  Created by 李明禄 on 15/10/28.
//  Copyright © 2015年 http://blog.csdn.net/netluoriver. All rights reserved.
//

import UIKit

class BaseViewController: UITableViewController {
    
    var userLogin = false
    
    ///添加访客视图属性
    var visitorView: VisitorView?
    
    
    
    override func loadView() {
        
        userLogin ? super.loadView() : setupVisitorView()
    }
    
    
    private func setupVisitorView()  {
        
        visitorView = VisitorView()
        view = visitorView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: nil, action: nil )
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: nil, action: nil )
       
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        visitorView?.delegate = self
        
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
       
    }

}

 extension BaseViewController: VisitorViewDelegate {

    func visitorViewWillRegister() {
        print(__FUNCTION__)
    }
    
    func visitorViewWillLogin() {
        print(__FUNCTION__)
    }
}
